#!/usr/bin/env ruby
#
#  Created by sjavey on 2007-10-01.
#  Copyright (c) 2007. All rights reserved.
require File.dirname(__FILE__) + '/../test_helper'

class UserHelperTest < Test::Unit::TestCase
  
  def setup
    @user = User.new("YOUR-ADOBEID_EMAIL","YOUR_PASSWORD")
    @share = Share.new(@user)  
  end
  

  def test_login
    @share.get_authorization_token
    puts @share.http_response_code
    puts @share.http_response_message
    assert @share.auth_token != nil
  end
  
  def test_start_session
      @share.get_authorization_token
      assert @share.auth_token != nil
      @share.start_session
      assert @share.session_id != nil
  end
  
  def test_get_my_library
    @share.get_authorization_token
    @share.start_session
    @share.get_my_library
    doc_id = nil
    @share.doc_nodes.each { |node|
      puts "#{node.owner} #{node.name}"
      doc_id = node.node_id
    }
    sleep 1
    #puts doc_id
    #@share.get_doc(doc_id, "thumbnail")
    @share.get_doc(doc_id, "src")
    assert true
  end
  
end